/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Admin;

import Login.MySqlConnector;
import Registration.RegistrationBean;
import java.sql.*;
/**
  *
  * @author Bharath
  */
public class ViewMemberDao {

    Connection con;
    PreparedStatement ps;
    ResultSet rs;
    MySqlConnector ms = new MySqlConnector();
    RegistrationBean rb = new RegistrationBean();
    GetImage getimage = new GetImage();
    
    public RegistrationBean view_member(String rcheck)
    {
        try {
            con = ms.Connect();
            String sql = "select * from registration where memberid = '" + rcheck + "';";
            System.out.println("Query in view_member() method is "+sql);
            ps = con.prepareStatement(sql);
            rs = ps.executeQuery();
            if (rs.next() == true)
            {  System.out.println("get value of member is is ");               
                rb.setMemberid(rs.getString(1));
                String mem = rb.getMemberid();
                rb.setSno(rs.getString(44));
                System.out.println("get value of member is is "+mem);
                rb.setPassword(rs.getString(2));
                rb.setName(rs.getString(3));
                rb.setSurname(rs.getString(4));
                rb.setAge(rs.getString(5));
                rb.setSex(rs.getString(6));
                rb.setCaste(rs.getString(7));
                rb.setDob(rs.getString(8));
                rb.setQualification(rs.getString(9));
                rb.setProf(rs.getString(10));
                rb.setOrg(rs.getString(11));
                rb.setRes_add(rs.getString(12));
                String res = rb.getRes_add();
                System.out.println("get value of member is "+res);
                rb.setOff_add(rs.getString(13));
                rb.setState(rs.getString(14));
                rb.setDist(rs.getString(15));
                rb.setMandal(rs.getString(16));
                rb.setRes_phone(rs.getString(17));
                rb.setOff_phone(rs.getString(18));
                rb.setMobile(rs.getString(19));
                rb.setEmail(rs.getString(20));
                rb.setWebadd(rs.getString(21));
                rb.setSpouse_name(rs.getString(22));
                rb.setSsex(rs.getString(23));
                rb.setSdob(rs.getString(24));
                rb.setMar_aniv(rs.getString(25));
                rb.setSqual(rs.getString(26));
                rb.setSprof(rs.getString(27));
                rb.setSorg(rs.getString(28));
                rb.setC1name(rs.getString(29));
                rb.setC1sex(rs.getString(30));
                rb.setC1dob(rs.getString(31));
                rb.setC1qual(rs.getString(32));
                rb.setC2name(rs.getString(33));
                rb.setC2sex(rs.getString(34));
                rb.setC2dob(rs.getString(35));
                rb.setC2qual(rs.getString(36));
                rb.setC3name(rs.getString(37));
                rb.setC3sex(rs.getString(38));
                rb.setC3dob(rs.getString(39));
                rb.setC3qual(rs.getString(40));
                // VView.add(index);//index 41
                //  VView.add(IS_img);// index 40
                rb.setFile(rs.getBinaryStream(43));
                System.out.println("****rb="+rb.getFile().available());
                rb.setStatus(rs.getString(42));
                //System.out.print("view vector sample :" + VView);
                return rb;
            }
            
         
        }   catch (Exception e) {
            e.printStackTrace();
        }
      return null;
    }
}
